﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AddTheatre.aspx.cs" Inherits="MovieTixStaff_AddTheatre" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<script runat="server">
    //public void function1(object source, ServerValidateEventArgs args)
    //{

    //    string username = UsernameTextbox.Text;
    //    Label2.Text = "1";

    //    string connectionString;
    //    connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    //    SqlConnection con = new SqlConnection(connectionString);
    //    SqlCommand cmd1 = new SqlCommand("SELECT TheatreStaffUserName,TheatreId from TheatreStaff WHERE TheatreStaffUserName=@TheatreStaffUserName", con);
    //    string ParamString = lblId.Text;
    //    Boolean Showing;

    //    cmd1.Parameters.AddWithValue("TheatreStaffUserName", username);
    //    using (con)
    //    {
    //        con.Open();
    //        SqlDataReader reader = cmd1.ExecuteReader();
    //        if (reader.HasRows)
    //        {
    //            Label2.Text = "1";
    //            args.IsValid = false;
    //            Showing = false;


    //        }
    //        else
    //        {
    //            Label2.Text = "2";
    //            Showing = true;
    //            args.IsValid = true;
    //        }
    //    }
    //}


    //public void Clear(object sender, EventArgs args)
    //{
    //    Label1.Text = string.Empty;


    //}
   // public void CreateUser_OnClick(object sender, EventArgs args)
   // {

   //     string username = UsernameTextbox.Text;
   //     Label2.Text = "1";

   //     string connectionString1;
   //     connectionString1 = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
   //     SqlConnection con1 = new SqlConnection(connectionString1);
   //     SqlCommand cmd1 = new SqlCommand("SELECT TheatreStaffUserName,TheatreId from TheatreStaff WHERE TheatreStaffUserName=@TheatreStaffUserName", con1);
   //     string ParamString = lblId.Text;
   //     Boolean Showing;

   //     cmd1.Parameters.AddWithValue("TheatreStaffUserName", username);
   //     using (con1)
   //     {
   //         con1.Open();
   //         SqlDataReader reader = cmd1.ExecuteReader();
   //         if (reader.HasRows)
   //         {
   //             Label2.Text = "1";

   //             Showing = false;


   //         }
   //         else
   //         {
   //             Label2.Text = "2";
   //             Showing = true;

   //         }
   //     }


   //     if (Showing == true)
   //     {

   //         MembershipCreateStatus result;

   //         try
   //         {
   //             // Create new user.

   //             if (Membership.RequiresQuestionAndAnswer)
   //             {
   //                 MembershipUser newUser = Membership.CreateUser(
   //                   UsernameTextbox.Text,
   //                   PasswordTextbox.Text,
   //                   EmailTextbox.Text,
   //                   PasswordQuestionTextbox.Text,
   //                   PasswordAnswerTextbox.Text,
   //                   true,
   //                   out result);


   //                 if (Roles.RoleExists("Theatre"))
   //                 {
   //                     if (!Roles.IsUserInRole("Theatre"))
   //                     {
   //                         Roles.AddUserToRole(UsernameTextbox.Text, "Theatre");
   //                     }
   //                 }
   //                 string connectionString;
   //                 connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

   //                 SqlConnection con = new SqlConnection(connectionString);
   //                 SqlCommand cmd = new SqlCommand("INSERT TheatreStaff(TheatreStaffUserName,TheatreStaffAcessLevel,TheatreId) values (@UName,@ALevel,@Id)", con);
   //                 cmd.Parameters.AddWithValue("@UName", UsernameTextbox.Text);
   //                 cmd.Parameters.AddWithValue("@ALevel", "Theatre");
   //                 cmd.Parameters.AddWithValue("@Id", lblId.Text);


   //                 using (con)
   //                 {
   //                     con.Open();
   //                     Int32 rowCount = cmd.ExecuteNonQuery();

   //                     if (rowCount > 0)
   //                     {
   //                         Label1.Text = "The New user has been added sucessfully to the theatre!";

   //                         UsernameTextbox.Text = "";
   //                         PasswordTextbox.Text = "";
   //                         EmailTextbox.Text = "";
   //                         PasswordQuestionTextbox.Text = "";
   //                         PasswordAnswerTextbox.Text = "";

   //                     }

   //                 }
   //             }
   //             else
   //             {
   //                 MembershipUser newUser = Membership.CreateUser(
   //                   UsernameTextbox.Text,
   //                   PasswordTextbox.Text,
   //                   EmailTextbox.Text);
   //                 if (Roles.RoleExists("Theatre"))
   //                 {
   //                     if (!Roles.IsUserInRole("Theatre"))
   //                     {
   //                         Roles.AddUserToRole(UsernameTextbox.Text, "Theatre");
   //                     }
   //                 }
   //                 string connectionString;
   //                 connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

   //                 SqlConnection con = new SqlConnection(connectionString);
   //                 SqlCommand cmd = new SqlCommand("INSERT TheatreStaff(TheatreStaffUserName,TheatreStaffAcessLevel,TheatreId) values (@UName,@ALevel,@Id)", con);
   //                 cmd.Parameters.AddWithValue("@UName", UsernameTextbox.Text);
   //                 cmd.Parameters.AddWithValue("@ALevel", "Theatre");
   //                 cmd.Parameters.AddWithValue("@Id", lblId.Text);


   //                 using (con)
   //                 {
   //                     con.Open();
   //                     Int32 rowCount = cmd.ExecuteNonQuery();

   //                     //if (rowCount > 0)
   //                     //{
   //                     //    lresult.Text = "The New user has been added sucessfully to the theatre!";
   //                     //}

   //                 }
   //             }

   //             //Response.Redirect("login.aspx");
   //         }
   //         catch (MembershipCreateUserException e)
   //         {
   //             Msg.Text = GetErrorMessage(e.StatusCode);
   //         }
   //         catch (HttpException e)
   //         {
   //             Msg.Text = e.Message;
   //         }

   //     }
   // }

   // public string GetErrorMessage(MembershipCreateStatus status)
   // {
   //     switch (status)
   //     {
   //         case MembershipCreateStatus.DuplicateUserName:
   //             return "Username already exists. Please enter a different user name.";

   //         case MembershipCreateStatus.DuplicateEmail:
   //             return "A username for that e-mail address already exists. Please enter a different e-mail address.";

   //         case MembershipCreateStatus.InvalidPassword:
   //             return "The password provided is invalid. Please enter a valid password value.";

   //         case MembershipCreateStatus.InvalidEmail:
   //             return "The e-mail address provided is invalid. Please check the value and try again.";

   //         case MembershipCreateStatus.InvalidAnswer:
   //             return "The password retrieval answer provided is invalid. Please check the value and try again.";

   //         case MembershipCreateStatus.InvalidQuestion:
   //             return "The password retrieval question provided is invalid. Please check the value and try again.";

   //         case MembershipCreateStatus.InvalidUserName:
   //             return "The user name provided is invalid. Please check the value and try again.";

   //         case MembershipCreateStatus.ProviderError:
   //             return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator.";

   //         case MembershipCreateStatus.UserRejected:
   //             return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator.";

   //         default:
   //             return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator.";
   //     }
   // }
   //protected void menuTabs_MenuItemClick(object sender, MenuEventArgs e)
   // {
   //     multiTabs.ActiveViewIndex = Int32.Parse(menuTabs.SelectedValue);
  

         
   // }

   
   //protected void update(object sender, EventArgs e)
   //{
   //    Label8.Text = "hello";
   //    SqlDataSource4.UpdateParameters["TheatreID"].DefaultValue = DropDownList2.SelectedItem.Value;
   //    SqlDataSource4.UpdateParameters["TheatreStaffUserName"].DefaultValue = DropDownList1.SelectedItem.Text;
   //    SqlDataSource4.Update();
   //    SqlDataSource4.InsertParameters["TheatreID"].DefaultValue = DropDownList2.SelectedItem.Value;
   //    SqlDataSource4.InsertParameters["TheatreStaffUserName"].DefaultValue = DropDownList1.SelectedItem.Text;
   //    SqlDataSource4.Insert();

   //}
</script>
<script runat="server">
    protected void function1(object sender, EventArgs e)
    {
        TextBox tb2 = (TextBox)frmAddTheatre.FindControl("txtTheatreName");
     
        Label1.Text = tb2.Text;
      

    }
    protected void clearall(object sender, EventArgs e)
    {
        Label1.Text = "";

    }
    protected void function2(object source, ServerValidateEventArgs args)
    {

        TextBox tb2 = (TextBox)frmAddTheatre.FindControl("txtTheatreName");

        LinkButton tb3 = (LinkButton)frmAddTheatre.FindControl("lnkInsert");
            string connectionString;
            connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            SqlConnection con = new SqlConnection(connectionString);
            SqlCommand cmd1 = new SqlCommand("SELECT *  from Theatre WHERE Theatrename=@Theatrename", con);

            Boolean Showing;
            cmd1.Parameters.AddWithValue("@Theatrename", tb2.Text);
            using (con)
            {
                con.Open();
                SqlDataReader reader = cmd1.ExecuteReader();
                if (reader.HasRows)
                {
                    Label7.Text = "";
                    args.IsValid = false;
                    Label1.Text = "This theatre name " + tb2.Text + " already exist, please try another name!";
                  
                    

                }
                else
                {
                    Label1.Text = "";
                    UpdatePanel2.Update();
                    args.IsValid = true;
                    Label7.Text = "A new theare is added successfully! ";
                    tb3.CommandName = "insert";
                  
                  
                  
                }
            }

    }
    protected void function3(object source, EventArgs e)
    {

        TextBox tb2 = (TextBox)frmAddTheatre.FindControl("txtTheatreName");

        LinkButton tb3 = (LinkButton)frmAddTheatre.FindControl("lnkInsert");
        string connectionString;
        connectionString = WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        SqlConnection con = new SqlConnection(connectionString);
        SqlCommand cmd1 = new SqlCommand("SELECT *  from Theatre WHERE Theatrename=@Theatrename", con);

        Boolean Showing;
        cmd1.Parameters.AddWithValue("@Theatrename", tb2.Text);
        using (con)
        {
            con.Open();
            SqlDataReader reader = cmd1.ExecuteReader();
            if (reader.HasRows)
            {
          
                Label1.Text = "This theatre name: "+tb2.Text+" already exist, please try another name!";
                tb3.CommandName = "";


            }
            else
            {

                UpdatePanel2.Update();
                Label7.Text = "A new theare is added successfully! ";
                tb3.CommandName = "insert";
              
             
              
            }
        }

    }

    protected void test4(object source, EventArgs e)
    {
        UpdatePanel2.Update();
        
    }
    protected void menuTabs_MenuItemClick(object sender, MenuEventArgs e)
    {
        multiTabs.ActiveViewIndex = Int32.Parse(menuTabs.SelectedValue);
        Label7.Text = "";
        Label1.Text = "";
        UpdatePanel2.Update();

    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">


    
<script type="text/javascript">
    function showInsert() {
     
        var divInsert = document.getElementById('divInsert');
        divInsert.style.display = 'block';
    }
    function MM_preloadImages() { //v3.0
        var d = document; if (d.images) {
            if (!d.MM_p) d.MM_p = new Array();
            var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
                if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
        }
    }
    function MM_findObj(n, d) { //v4.01
        var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
            d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
        }
        if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
        for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
        if (!x && d.getElementById) x = d.getElementById(n); return x;
    }
    function MM_swapImage() { //v3.0
        var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
            if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
    }
    function MM_swapImgRestore() { //v3.0
        var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
    }
</script>
<%--This below code from the website:http://ramanisandeep.wordpress.com/2008/11/07/hide-an-aspnet-label-control-after-a-few-seconds/--%>
<script type="text/javascript">
self.setInterval("changeValue1()",5200);

function changeValue1()
{
document.getElementById("Label7").innerText = "";

}
self.setInterval("changeValue()", 5200);
function changeValue() {
    document.getElementById("Label1").innerText = "";

}
</script>


<style type="text/css">

        .menuTabs
        {
            position:relative;
            top:1px;
            left:10px;
        }
        .tab
        {
            border:Solid 1px white;
            border-bottom:none;
            padding:0px 10px;
            background-color:Gray;
        }
        .selectedTab
        {
            border:Solid 1px black;
            border-bottom:Solid 1px white;
            padding:0px 10px;
            background-color:white;
        }
        .tabBody
        {
            border:Solid 1px white;
            padding:20px;
         
        }
    </style>
   <style type="text/css"> 
 
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
           
        }
    
    </style>
<style type="text/css">
.First
{
    color:White;
}
#divDisplay
{
    border:solid 1px White;
    width:850px;
    padding:15px;
    margin:0px auto;
    text-align:center;
    border:1px solid #333;
}
#divInsert
{
    display:none;
    border:solid 1px black;
    width:500px;
    position:absolute;
    top:450px;
    left:300px;
    padding:10px;
    background-color:White;
    color:black;

}
#divInsert a
{
    color:Black;
}
html
{
  background-image:url('image/back.jpg'); 

    padding:10px;
    color:White;    
  
}

.content
{
 width:950px;
    margin:auto;
        height: 197px;
    }

.link
{
  margin-left:350px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link2
{
  margin-left:50px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
a
{
 color: white;
 text-decoration:underline;
 font-weight:bold;
 

}
a:hover
{
 color: red; 
  text-decoration:none;
  font-weight:bold;

}
.join
{
   background-color:#0099FF;
  clip:auto;
  font-weight:bold;
  font-size:large;
}
.table2
{
 border-style:solid;
   border-color:Black;
   background-color:White;
   color:Black;  
   width:900px; 
}
.row
{
   background-color:Gray;
   color:White;
}
.ticket
{
   background-color:#CC0000;
color:White;

}

.ticket:hover
{
 color: black; 
  text-decoration:none;


}
    .style1
    {
        width: 509px;
    }
    
.footer
{

     font-weight:bold;
  font-size:large;  

}
.ticket1
{
    padding-left:200px;
}
.view2
{
 padding-left:180px;  
}
.view4
{
 padding-left:780px;  
}
.text
{
 font-weight:bold;
}
.button
{
 margin-left:250px;
}
.view3
{
    padding-left:120px;
}
.footer
{

   margin-top:250px;
}
</style>
    <title>Add Theatre Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content">
 <asp:Image ID="Image1" Width="1000" Height="130" ImageUrl="~/image/tdk-jun5-bannerbatmanexclusivo2.jpg" runat="server" />
<asp:HyperLink ID="HyperLink14"  CssClass="link" NavigateUrl="~/Default.aspx" runat="server">Home</asp:HyperLink>
<asp:HyperLink ID="HyperLink1"  CssClass="link2" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink> <asp:HyperLink ID="HyperLink2" CssClass="link2" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" CssClass="link2"  NavigateUrl="~/Price.aspx" runat="server">Prices</asp:HyperLink>

<%--<asp:HyperLink ID="HyperLink6" CssClass="link2"  NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink>--%>
 <br /> <br />
      
      
    <asp:Label ID="Label5"  CssClass="view4" runat="server" Text="UserName" Font-Bold="True"></asp:Label>    <asp:LoginName ID="LoginName1" runat="server" /> 
    &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp<asp:LoginStatus ID="LoginStatus1" runat="server" />
<table align="center" >
<%--<td>
    
     <asp:Menu id="menuTabs"
      StaticMenuItemStyle-BackColor="#333333" 
        StaticMenuItemStyle-Font-Size="Larger"
       DynamicHorizontalOffset="0"   
      DynamicHoverStyle-BackColor="#666666"
        DynamicMenuItemStyle-Width="150px"
       DynamicMenuItemStyle-BackColor="#333333" runat="server" Font-Size="Medium">
<StaticMenuItemStyle BackColor="#333333" Font-Size="Larger"></StaticMenuItemStyle>

<DynamicHoverStyle BackColor="#666666"></DynamicHoverStyle>

<DynamicMenuItemStyle BackColor="#333333" Width="150px"></DynamicMenuItemStyle>
       <Items>
            <asp:MenuItem
            Selectable="True" Text ="StaffMenu" 
            NavigateUrl ="~/MovieCinema2.aspx"  >
            </asp:MenuItem>
       </Items> 
     </asp:Menu>
    </td>--%>
    <%--&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp--%>

 

 <tr>
<td>
     <h2><asp:Label ID="Label3"  ForeColor="Aquamarine" Text ="Theatre Maintenance" CssClass ="First"  runat="server" /></h2>
</td>
</tr>

  </table>
   <br />
   <hr /> 
        <asp:BulletedList ID="BulletedList1" CssClass ="First" runat="server">
            <asp:ListItem Text ="Click the 'Insert Theatre' button to add a new Theatre" />
            <asp:ListItem Text="Click 'Cancel' on the 'Insert Theatre' section to return to the Theatre Maintenance section" />
            <asp:ListItem Text="Use the 'Add new user to theatre' section to add a new user to the creating theatre" />
        </asp:BulletedList><hr />
   <br />
     <asp:Label ID="lblId" runat="server" Visible="false" ></asp:Label>
           <asp:ScriptManager ID="ScriptManager1" runat="server" />
              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
              <ContentTemplate>
                 <asp:Label ID="Label1" CssClass="view2" runat="server" Font-Bold="True"  Font-Size="Larger" ForeColor="Red"></asp:Label>
                  <asp:Label ID="Label7" runat="server"  Font-Bold="True"  Font-Size="Larger"  ForeColor="#FFFFCC"></asp:Label>
        
        <div id="divDisplay" align="center">
         <table  width="900px"  cellpadding="30px">
       
            <tr align ="center" valign="top">
                <td align="left">
                <h3><asp:Label ID="Label54" Text ="Theatre Details" runat="server" /></h3>
                    <asp:GridView ID="grdAddTheatre"   OnPageIndexChanged="clearall"
                    AllowPaging="true" AutoGenerateColumns ="False" 
                    DataSourceID ="srcTheatre" 
                    DataKeyNames ="TheatreId"
                     runat ="server" >
                        <Columns >
                            <asp:BoundField DataField ="TheatreName" HeaderText ="Theatre Name" />
                            <asp:BoundField DataField="NumberOfCinemas" HeaderText ="Number of Cinemas" />
                        </Columns>
                     </asp:GridView> 
                          <a href="JavaScript:showInsert();" >Insert Theatre</a>
                </td><td valign="top">
           

           
           
                
              <asp:Menu  id="menuTabs" 
  CssClass="menuTabs"
        StaticMenuItemStyle-CssClass="tab" StaticMenuItemStyle-ForeColor="Black"
        StaticSelectedStyle-CssClass="selectedTab"  Orientation="Horizontal"  OnMenuItemClick="menuTabs_MenuItemClick"   Runat="server">
     <Items>
        <asp:MenuItem
            Text="[Add new user to theatre]"
            Value="0" 
            Selected="true" />
        <asp:MenuItem
            Text="[Change an existing user to the theatre]" 
            Value="1"/>
         </Items>
            </asp:Menu>   
     <div class="tabBody">  
      
   <asp:MultiView id="multiTabs" ActiveViewIndex="0" Runat="server">
 
    <asp:View id="view1" runat="server" >
        <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
        <ContentTemplate>
<iframe id="Iframe1" src="adduser.aspx"  onload="test4" width="500px" height="500px" frameborder="0" runat="server" />
   </ContentTemplate>
        </asp:UpdatePanel>
    </asp:View>
          <asp:View id="view2"   runat="server" >
            
<%--  <asp:Label ID="Label8" runat="server" ></asp:Label>
   <asp:Button ID="Button1"   CommandName="PrevView"  runat="server" Text="Button" />


          <table>
<tr><td><asp:Label ID="Label6" runat="server" Text="Please select a theatre staff"></asp:Label> </td> 
<td> <asp:DropDownList id="DropDownList1"   DataSourceID="SqlDataSource2" DataTextField="TheatreStaffUserName" DataValueField="TheatreStaffUserName" runat="server">
</asp:DropDownList>  
       
 <asp:SqlDataSource id="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [TheatreStaffUserName] FROM [TheatreStaff]"></asp:SqlDataSource>   </td></tr>      
          
  <tr><td><asp:Label ID="Label7" runat="server" Text="Move to the theatre:"></asp:Label> </td> 
<td> <asp:DropDownList id="DropDownList2"   AutoPostBack="true" DataSourceID="SqlDataSource3" DataTextField="TheatreName" DataValueField="TheatreId" runat="server">
</asp:DropDownList>  
       
 <asp:SqlDataSource id="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                
        SelectCommand="SELECT DISTINCT [TheatreId], [TheatreName] FROM [Theatre]"></asp:SqlDataSource>   </td></tr>              
 
  </table>
             
 
  <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
  ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 

 UpdateCommand="UPDATE [TheatreStaff] SET [TheatreId] = @TheatreId WHERE [TheatreStaffUserName] = @TheatreStaffUserName" 
                 
 InsertCommand="INSERT INTO [TheatreStaff] ([TheatreId]) VALUES (@TheatreId) where TheatreStaffUserName=@TheatreStaffUserName" >

 <UpdateParameters>
              
 <asp:Parameter Name="TheatreId" Type="Int16"  />
     <asp:Parameter Name="TheatreStaffUserName" Type="String"  />          
 </UpdateParameters>
         
  <InsertParameters>
   
  <asp:Parameter Name="TheatreId" Type="Int16" />
  <asp:ControlParameter Name="TheatreStaffUserName"  PropertyName="SelectedValue" />
      </InsertParameters>
         
              </asp:SqlDataSource>--%> 
              <asp:UpdatePanel ID="UpdatePanel3" runat="server">
              <ContentTemplate>
           <iframe id="Iframe2" src="changeuser.aspx"  width="450" frameborder="0" height="220px"   runat="server"/>
           </ContentTemplate>
           </asp:UpdatePanel>  
             
           
             <Br />
                         

    </asp:View>
    </asp:MultiView> 
          
         </div>            
                
  </td></tr>
         </table> 
     
           
         
         
         
          </div>
          <div id="divInsert">
           <%--<table align="center">
	        <tr>
	            <td>--%>
              <asp:Label ID="Label2" runat="server" Text=" Please complete the following form to insert New Theatre: " Font-Bold="True" Font-Size="Larger" ForeColor="#333399"></asp:Label><br />
	             <asp:FormView ID ="frmAddTheatre" 
	                DataSourceID ="srcTheatre" 
	                runat ="server" DefaultMode ="Insert" OnItemInserted="test4"   AllowPaging="false"  >
	                   <InsertItemTemplate >
	                    <table >
	                        <tr>
	                            <td>
	                                  <asp:Label ID="lblTheatreName"
	                                    Text="Theatre Name" Font-Bold ="true" AssociatedControlID ="txtTheatreName"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatreName"    Font-Bold ="true" Text ='<%#Bind("TheatreName") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td colspan="2">
	                                <asp:CustomValidator ID="CustomValidator1"  OnServerValidate="function2" ControlToValidate="txtTheatreName" runat="server" ErrorMessage="This theatre name already exist, please try another name!" />              
                        <asp:RequiredFieldValidator ID="reqTheatreName" ControlToValidate ="txtTheatreName" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                        </tr>
	                        <tr>
	                            <td>
	                                  <asp:Label ID="Label2"
	                                    Text="Number of Cinemas" Font-Bold ="true" AssociatedControlID ="txtCinema"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtCinema"    Font-Bold ="true" Text ='<%#Bind("NumberOfCinemas") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate ="txtCinema" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <td>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server"
                                    ControlToValidate ="txtCinema" 
                                     ErrorMessage="(Enter a numeric value for the number of cinemas)" Type="Integer" Operator="DataTypeCheck"></asp:CompareValidator>
	                            </td>
	                        </tr>
	                        <tr>
	                            <td>
	                                  <asp:Label ID="Label3"
	                                    Text="Theatre Address" Font-Bold ="true" AssociatedControlID ="txtTheatreAddress"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatreAddress"    Font-Bold ="true" Text ='<%#Bind("TheatreAddress") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td colspan ="2">
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate ="txtTheatreAddress" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <%--<td>
                                    <asp:CompareValidator ID="CompareValidator2" runat="server"
                                    ControlToValidate ="txtCinema" 
                                     ErrorMessage="Enter a numeric value for the number of cinemas" Type="Integer" Operator="DataTypeCheck"></asp:CompareValidator>
	                            </td>--%>
	                        </tr>
	                        <tr>
	                            <td>
	                                  <asp:Label ID="Label4"
	                                    Text="Theatre Suburb" Font-Bold ="true" AssociatedControlID ="txtTheatreSuburb"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatreSuburb"    Font-Bold ="true" Text ='<%#Bind("TheatreSuburb") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td colspan ="2">
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ControlToValidate ="txtTheatreSuburb" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <%--<td>
                                    <asp:CompareValidator ID="CompareValidator2" runat="server"
                                    ControlToValidate ="txtCinema" 
                                     ErrorMessage="Enter a numeric value for the number of cinemas" Type="Integer" Operator="DataTypeCheck"></asp:CompareValidator>
	                            </td>--%>
	                        </tr>
	                         <tr>
	                            <td>
	                                  <asp:Label ID="Label6"
	                                    Text="Theatre Postcode" Font-Bold ="true" AssociatedControlID ="txtTheatrePostcode"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatrePostcode"    Font-Bold ="true" Text ='<%#Bind("TheatrePostcode") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate ="txtTheatrePostcode" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <td>
                                      <asp:RegularExpressionValidator ID="regPostcode" runat="server" ErrorMessage="(Please enter only 4 numeric values for postcode)" ControlToValidate="txtTheatrePostcode" ValidationExpression="^\d{4}$"></asp:RegularExpressionValidator>
	                            </td>
	                        </tr>
	                        
	                        <tr>
	                            <td>
	                                  <asp:Label ID="Label8"
	                                    Text="Theatre Email" Font-Bold ="true" AssociatedControlID ="txtTheatreEmail"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatreEmail"    Font-Bold ="true" Text ='<%#Bind("TheatreEmail") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator6" ControlToValidate ="txtTheatreEmail" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <td>
                                      <asp:RegularExpressionValidator ID="regEmail" runat="server" ErrorMessage="(Please enter a valid email address)" ControlToValidate="txtTheatreEmail" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
	                            </td>
	                        </tr>
	                        
	                         <tr>
	                            <td>
	                                  <asp:Label ID="Label9"
	                                    Text="Theatre Phone Number" Font-Bold ="true" AssociatedControlID ="txtTheatrePhoneNumber"
	                                    runat ="server" />
	                            </td>
	                            <td>
	                                <asp:TextBox ID="txtTheatrePhoneNumber"    Font-Bold ="true" Text ='<%#Bind("TheatrePhoneNumber") %>'
	                                runat ="server" /> 
	                            </td>
	                            <td>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate ="txtTheatrePhoneNumber" runat="server" ErrorMessage="(Required)"></asp:RequiredFieldValidator> 
	                            </td>
	                            <td>
                                      <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="(Please enter only 10 numeric values for mobile phone number)" ControlToValidate="txtTheatrePhoneNumber" ValidationExpression="^\d{10}$"></asp:RegularExpressionValidator>
	                            </td>
	                        </tr>
	                        <tr>
	                            <td >
	                                 <asp:LinkButton ID="lnkInsert" Text="Insert Theatre" 
	                                    runat ="server" /> 
	                            </td> 
	                            <td colspan ="3">
	                                    <asp:LinkButton ID="lnkCancel" Text="Cancel" 
	                                    CommandName ="Cancel" CausesValidation ="false"  
	                                    runat ="server" /> 
	                            </td>
	                        </tr>
	                    
	                    </table>
	                   </InsertItemTemplate>
	              </asp:FormView>   
	              
	              
	              
	              
	              
	              
	   
             
        </div>
           </ContentTemplate>
              </asp:UpdatePanel>
        <%--<asp:SqlDataSource ID="srcTheatre" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MovieTixConnectionString %>" 
            SelectCommand="SELECT Theatre.* FROM Theatre"
            InsertCommand="INSERT INTO Theatre (TheatreName)
            VALUES (@TheatreName)"></asp:SqlDataSource>--%>
         
        <asp:SqlDataSource ID="srcTheatre" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            SelectCommand="SELECT Theatre.* FROM Theatre"
            InsertCommand="INSERT INTO Theatre (TheatreName,NumberOfCinemas,TheatreAddress,TheatreSuburb,TheatrePostcode,TheatreEmail,TheatrePhoneNumber)
            VALUES (@TheatreName,@NumberOfCinemas,@TheatreAddress,@TheatreSuburb,@TheatrePostcode,@TheatreEmail,@TheatrePhoneNumber)"></asp:SqlDataSource>
       
  
    <table width="100" cellpadding="15" ><tr><td>Copyright@2012 MovieTix</td><td><asp:HyperLink ID="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  CssClass="footer" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  CssClass="footer" NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  CssClass="footer" NavigateUrl="~/Login.aspx" runat="server">Log In</asp:HyperLink></td></tr></table>
  </div>
</form></body>
</html>
